package com.by.facade.enums.information;

import com.by.facade.enums.userbehaviorlog.UserBehaviorTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2024/2/28 10:30 AM
 */
@Getter
@AllArgsConstructor
public enum PromotionPlatformEventTypeEnum {

    FORM(1, "表单", UserBehaviorTypeEnum.BIND_PHONE.getCode()),
    WX_CP_FRIEND_OPERATION(2, "完成加V", UserBehaviorTypeEnum.ADD_WXCP_FRIEND.getCode()),
    ;

    private final Integer type;

    private final String desc;

    private final Integer userBehaviorType;

    private static final Map<Integer, Integer> MAP;

    static {
        MAP = Stream.of(PromotionPlatformEventTypeEnum.values()).collect(Collectors.toMap(PromotionPlatformEventTypeEnum::getUserBehaviorType, PromotionPlatformEventTypeEnum::getType));
    }

    public static Integer resolveByUserBehaviorType(Integer type) {
        return MAP.get(type);
    }


}
